package com.stormrage.edu.serv.learn.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.stormrage.edu.dao.learn.LeaBunchApplyDao;
import com.stormrage.edu.serv.edu.impl.EduModuleServImpl;
import com.stormrage.edu.serv.learn.LeaBunchApplyServ;
import com.stormrage.entity.learn.LeaBunchApply;
import com.stormragetech.core.exception.StormrageTechException;

/**
 * @Title: LeaBunchApplyServImpl.java
 * @Package com.stormrage.edu.serv.learn.impl
 * @Description: 班级报名 Service
 * @author www.stormragetech.com
 * @date 2016年4月15日
 * @version V1.0
 */
@Service
public class LeaBunchApplyServImpl implements LeaBunchApplyServ {

	private static final Logger logger = LoggerFactory.getLogger(EduModuleServImpl.class);

	@Autowired
	private LeaBunchApplyDao leaBunchApplyDao;

	@Override
	public void updateLock(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 updateLock 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("id", arg0);

		leaBunchApplyDao.updateLock(map);

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 updateLock 】- 完成运行 ");

	}

	@Override
	public void updateLockToSchedule(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 updateLockToSchedule 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("id", arg0);

		leaBunchApplyDao.updateLockToSchedule(map);

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 updateLockToSchedule 】- 完成运行 ");

	}

	@Override
	public void deletebyBunch(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 deletebyBunch 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("bunchId", arg0);

		leaBunchApplyDao.deletebyBunch(map);

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 deletebyBunch 】- 完成运行 ");

	}

	@Override
	public LeaBunchApply queryById(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 queryById 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("Id", arg0);

		LeaBunchApply entity = leaBunchApplyDao.queryById(map);

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 queryById 】- 完成运行 ");
		return entity;

	}

	@Override
	public List<LeaBunchApply> queryByLock(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 queryByLock 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("locked", arg0);

		List<LeaBunchApply> array = leaBunchApplyDao.queryByLock(map);

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 queryByLock 】- 完成运行 ");
		return array;

	}

	@Override
	public List<LeaBunchApply> queryByBunchId(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 QueryByBunchId 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("bunchId", arg0);

		List<LeaBunchApply> array = leaBunchApplyDao.queryByBunchId(map);

		logger.debug(" 【 Serv 】- 【 LeaBunchApplyServ 】- 【 QueryByBunchId 】- 完成运行 ");
		return array;

	}

}
